package com.jingtai.platform.controller.supply;

import com.jingtai.core.entity.BaseEntity;
import com.jingtai.core.entity.supply.SupplyGoodsWarehouse;
import com.jingtai.platform.service.supply.SupplyGoodsWarehouseService;
import com.jingtai.platform.util.ResultUtil;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import com.jingtai.validate.swagger.CApiParam;

/**
 * 供应商商品属性表
 *
 * @author sunlaiqian
 * @date 2020-12-02 18:31:32
 */
@Validated
@RestController
@RequestMapping("/platform/supplygoodswarehouse")
@Api(tags = "供应商商品属性表")
public class SupplyGoodsWarehouseController{

    @Autowired
    private SupplyGoodsWarehouseService supplyGoodsWarehouseService;


    @ApiOperation("供应商商品属性表列表查询")
    @GetMapping("/list")
    public ResultUtil aopSupplyGoodsWarehouseList(@CApiParam(name = "page",value = "页数",required = true,cNotEmpty = true,cIntMin = 1) @RequestParam("page") Integer page,
                              @CApiParam(name = "limit",value = "每页个数",required = true,cNotEmpty = true,cIntMin = 1) @RequestParam("limit") Integer limit,
                              @CApiParam(name = "conditions",value = "查询条件",required = false) @RequestParam("conditions") String conditions){
        return supplyGoodsWarehouseService.SupplyGoodsWarehouselist(page, limit, conditions);
    }


    @ApiOperation("根据ID查询supplyGoodsWarehouse实体")
    @GetMapping("/getSupplyGoodsWarehouseById")
    public ResultUtil GetSupplyGoodsWarehouseById(@CApiParam(name = "id",value = "supplyGoodsWarehouse实体ID",required = true,cNotEmpty = true) @RequestParam("id") Long id){
        return supplyGoodsWarehouseService.getSupplyGoodsWarehouseById(id);
    }

    @ApiOperation("根据商品编码查询supplyGoodsWarehouse实体")
    @GetMapping("/getSupplyGoodsWarehouseByGoodsCode")
    public ResultUtil GetSupplyGoodsWarehouseByGoodsCode(@CApiParam(name = "goodsCode",value = "supplyGoodsWarehouse实体商品编码",required = true,cNotEmpty = true) @RequestParam("goodsCode") String goodsCode){
        return supplyGoodsWarehouseService.getSupplyGoodsWarehouseByGoodsCode(goodsCode);
    }

    @ApiOperation("新增supplyGoodsWarehouse实体")
    @PostMapping("/add")
    @ApiOperationSupport(ignoreParameters = {"supplyGoodsWarehouse.id","supplyGoodsWarehouse.createTime","supplyGoodsWarehouse.updateTime","supplyGoodsWarehouse.deleteFlag"})
    public ResultUtil aopAddSupplyGoodsWarehouse(@RequestBody @Validated({BaseEntity.Create.class}) SupplyGoodsWarehouse supplyGoodsWarehouse){
        return supplyGoodsWarehouseService.addSupplyGoodsWarehouse(supplyGoodsWarehouse);
    }

    @ApiOperation("编辑supplyGoodsWarehouse实体")
    @PostMapping("/edit")
    @ApiOperationSupport(ignoreParameters = {"supplyGoodsWarehouse.createTime","supplyGoodsWarehouse.updateTime","supplyGoodsWarehouse.deleteFlag"})
    public ResultUtil aopEditSupplyGoodsWarehouse(@RequestBody @Validated({BaseEntity.Update.class}) SupplyGoodsWarehouse supplyGoodsWarehouse){
        return supplyGoodsWarehouseService.editSupplyGoodsWarehouse(supplyGoodsWarehouse);
    }

    @ApiOperation("根据ID删除supplyGoodsWarehouse实体")
    @GetMapping("/delSupplyGoodsWarehouseById")
    public ResultUtil aopDelSupplyGoodsWarehouseById(@CApiParam(name = "id",value = "supplyGoodsWarehouse实体ID",required = true,cNotEmpty = true) @RequestParam("id") Long id){
        return supplyGoodsWarehouseService.delSupplyGoodsWarehouseById(id);
    }

}






